package com.example.caffeinecache01;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

import java.util.Random;

@SpringBootApplication
@EnableCaching//新增注解
@Slf4j
public class Caffeinecache01Application {

    private final static Logger logger = LoggerFactory.getLogger(Caffeinecache01Application.class);

    public static void main(String[] args) throws InterruptedException {
        SpringApplication.run(Caffeinecache01Application.class, args);
        Random rand =new Random(25);


        // try {
        //     int r = 1 / 0;
        // } catch (Exception e) {
        //     logger.error(e.getMessage(),e);
        // }



        while (true) {
            Thread.sleep(1000);
            // logger.info("logback 成功了");
            // logger.error("logback error");
            // logger.debug("logback debug");

            log.info("log 成功了");
            log.error("log error");
            log.debug("log debug");


            int i;
            i=rand.nextInt(100);


            log.info("绑定耗时: " + i);

        }
    }

}
